<template>
  <div class="cards-grid">
    <div v-for="(item, index) in cardList" :key="index">
      <div class="stats-card " :style="item.style">
        <div class="icon-container">
            <i :class='item.icon'></i>
        </div>
        <div class="text-container">
          <div class="number">{{ item.value }}</div>
          <div class="label">{{ item.label }}</div>
        </div>
        <!-- 气泡 -->
        <div class="corner-decoration"></div>
        <!-- 迷你趋线 -->
        <div class="sparkline"></div>
        <!-- 小圆点 -->
        <div class="status-dot"></div>
        <div class="trend-badge" v-if="!!item.trend">
          <i class="fas fa-arrow-up"></i>
          {{item.trend}}%
        </div>
      </div>
    </div>
  </div>
</template>

<script lang="ts" setup>
import { cardObject } from '../../../utils/type';
defineProps<{
  cardList: cardObject[],
}>()
</script>

<style scoped>
.cards-grid {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 24px;
  margin-bottom: 32px;
}

@media (min-width: 768px) {
  .cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .cards-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.stats-card {
  position: relative;
  padding: 50px;
  border-radius: 16px;
  color: white;
  overflow: hidden;
  transition: all 0.3s ease;
  cursor: pointer;
}

.stats-card:hover {
  transform: scale(1.05);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* 悬浮动画 */
.stats-card:hover .icon-container {
  animation: float 3s ease-in-out infinite;
}

/* 文字容器 */
.text-container {
  position: relative;
  z-index: 10;
}

.number {
  font-size: 3.25rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.label {
  font-size: 1.125rem;
  opacity: 0.9;
}

/* 角落装饰 */
.corner-decoration {
  position: absolute;
  top: -16px;
  right: -16px;
  width: 64px;
  height: 64px;
  border-radius: 9999px;
  background-color: rgba(255, 255, 255, 0.1);
}

/* 迷你趋势线 */
.sparkline {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(to right, rgba(255, 255, 255, 0.3), transparent);
}

/* 状态圆点 */
.status-dot {
  position: absolute;
  bottom: 16px;
  right: 16px;
  width: 12px;
  height: 12px;
  border-radius: 9999px;
  background-color: rgba(255, 255, 255, 0.8);
}

/* 趋势标签 */
.trend-badge {
  position: absolute;
  bottom: 16px;
  left: 400px;
  padding: 4px 12px;
  border-radius: 9999px;
  background-color: rgba(0, 0, 0, 0.1);
  font-size: 1.275rem;
  display: flex;
  align-items: center;
  gap: 4px;
}

</style>
